<?php
$bloc = "{bloc}";
require_once('module/TPLN/TPLN.php');
$TPLN = new TPLN();
$TPLN->CreateVirtualTemplate($bloc);

function box_edition_stats(&$TPLN,$query,$item){
	if($TPLN->ItemExists($item)){
		$result = rportalrequete($query) or rportalerreur($query,"?op=");
		$nb=rportalligne($result);
		$TPLN->Parse($item,$nb['nb']);
	}
}

$query = "SELECT count(*) AS nb FROM html";
box_edition_stats($TPLN,$query,'nb_page');

$query = "SELECT count(*) AS nb FROM html WHERE publier='1'";
box_edition_stats($TPLN,$query,'nb_pub');

$query = "SELECT sum(compteur) AS nb FROM html WHERE publier='1'";
box_edition_stats($TPLN,$query,'nb_visite');

$query = "SELECT count(*) AS nb FROM html WHERE verrou<>'0'";
box_edition_stats($TPLN,$query,'nb_verrou');

$TPLN->Write();
?>